Skip to content

fix(security): remove shell injection surface and block directory traversal#47

Merged
stackbilt-admin merged 1 commit intomainfrom
fix/security-shell-traversal
Mar 9, 2026
Merged

fix(security): remove shell injection surface and block directory traversal#47
stackbilt-admin merged 1 commit intomainfrom
fix/security-shell-traversal

Conversation

@SmartBrandStrategies
Copy link
Copy Markdown
Contributor

Summary

Two targeted security fixes with no functional behavior change for valid inputs.

  • shell: true in git operations creates command injection vector #43shell: true in git operations (HIGH): Removed shell: true from runGit() in git-helpers.ts. Node.js resolves the git binary via PATH directly on WSL, Linux, macOS, and Windows without needing a shell. The flag was a historical cross-platform workaround that is no longer necessary and creates a surface where shell metacharacters in args could be interpreted as shell syntax.

  • Directory traversal vulnerability in ADF module path construction #42 — Directory traversal in adf create (HIGH): User-supplied module names are now validated before path.join. Paths containing .. or absolute paths are rejected immediately. A secondary resolved-path check confirms the final path stays within aiDir, guarding against platform-specific bypass patterns (e.g. URL-encoded separators).

Test plan

  • charter adf create ../../../etc/passwd → rejected with clear error
  • charter adf create /absolute/path → rejected with clear error
  • charter adf create my-module → works as before
  • charter adf create subdir/my-module → works as before
  • All 272 existing tests pass
  • runGit() still resolves git correctly on WSL (PATH-based resolution)

🤖 Generated with Claude Code

…versal

Closes #43: Remove shell: true from runGit() in git-helpers.ts. Node.js
resolves the git binary via PATH directly without a shell on WSL, Linux,
macOS, and Windows. shell: true is unnecessary and allows shell metacharacters
in args to be interpreted as shell syntax.

Closes #42: Validate module paths in adf create before path.join. Paths
containing ".." or absolute paths are rejected with a clear error. A secondary
resolved-path check confirms the final path stays within the .ai/ directory,
guarding against platform-specific bypass patterns.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@stackbilt-admin stackbilt-admin merged commit e269c7b into main Mar 9, 2026
1 of 4 checks passed
@stackbilt-admin stackbilt-admin deleted the fix/security-shell-traversal branch March 9, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants